package com.zidian.study.activity;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.zidian.student.trucks.R;
import com.zidian.study.bean.UserMessageBean;
import com.zidian.study.globa.ToolBarActivity;

import butterknife.Bind;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * Created by GongCheng on 2016/12/7.
 */

public class MyScoreActivity extends ToolBarActivity {
    @Bind(R.id.my_score_head_portrait)
    CircleImageView myScoreHeadPortrait;
    @Bind(R.id.my_score_name)
    TextView myScoreName;
    @Bind(R.id.my_score_score)
    TextView myScoreScore;
    @Bind(R.id.my_score_level)
    TextView myScoreLevel;
    @Bind(R.id.my_score_experience)
    TextView myScoreExperience;
    @Bind(R.id.my_score_next_level)
    TextView myScoreNextLevel;
    @Bind(R.id.my_score_progress)
    ProgressBar myScoreProgress;
    private UserMessageBean bean;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setToolbarView(R.layout.toolbar_left);
        setContentView(R.layout.activity_my_score);
        ButterKnife.bind(this);
        setTitle("我的吱点");
        bean = new UserMessageBean();
        bean = (UserMessageBean) getIntent().getSerializableExtra("studyMessage");
        initView();
    }

    private void initView() {
        Glide.with(this)
                .load(bean.getData().getStudentHeadPortrait())
                .placeholder(R.drawable.student)
                .into(myScoreHeadPortrait);
        myScoreName.setText(bean.getData().getStudentName());
        myScoreLevel.setText(bean.getData().getStudentIntegralGrade() + "");
        myScoreProgress.setProgress(bean.getData().getStudentExperience());
        myScoreExperience.setText(bean.getData().getStudentExperience() + "/" + bean.getData().getStudentExperienceMax());
        int toNextLevel = bean.getData().getStudentExperienceMax() - bean.getData().getStudentExperience();
        myScoreNextLevel.setText("距离下一个等级还有" + toNextLevel + "个吱点");
    }
}
